package com.ccb.sc.common.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * @author Ken
 * @date 2020/7/15
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum ValidStatus implements IEnum<Integer> {

    /**
     * 有效
     */
    VALID(1, "有效"),

    /**
     * 无效
     */
    INVALID(0, "无效");

    private int value;
    private String desc;

    ValidStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static ValidStatus getByValue(int value) {
        for (ValidStatus validStatus : ValidStatus.values()) {
            if (validStatus.getValue() == value) {
                return validStatus;
            }
        }
        return null;
    }
}
